<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"      
	  xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      >
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Insert title here</title>
	</head>
	<body>
	<h:form>
		<h:panelGrid columns="2">
			<h:outputLabel for="title" value="Tytuł: *"/>
			<h:inputText id="title" value="#{displayAdvertisementsBean.titleLike}"/>
			
			<h:outputLabel for="content" value="Treść: *"/>
			<h:inputSecret id="content" value="#{displayAdvertisementsBean.contentLike}"/>
			
			<h:outputLabel for="category" value="KATEGORIA: *"/>
			<h:selectOneListbox id="category" value="#{displayAdvertisementsBean.category}">
				<f:selectItems value="#{categoryBean.categories}" var="y"
   					itemLabel="#{y.name}" itemValue="#{y.name}"/>
			</h:selectOneListbox>
			
			<h:outputLabel for="type" value="RODZAJ OFERTY: *"/>
			<h:selectOneListbox id="type" value="#{displayAdvertisementsBean.type}">
				<f:selectItems value="#{advertisementTypeBean.types}" var="y"
   					itemLabel="#{y.name}" itemValue="#{y.name}"/>
			</h:selectOneListbox>
			
			<h:outputLabel for="addedAfter" value="DODANE PRZED: *"/>
			<h:inputText id="addedAfter" value="#{displayAdvertisementsBean.addedAfter}">
				<f:convertDateTime pattern="dd.MM.yyyy" />
			</h:inputText>
			
			<h:outputLabel for="activeToDate" value="WAŻNA DO: *"/>
			<h:inputText id="activeToDate" value="#{displayAdvertisementsBean.activeToDate}">
				<f:convertDateTime pattern="dd.MM.yyyy" />
			</h:inputText>
			
			<h:outputLabel for="button"/>
			<h:commandButton id="button" value="OK" action="#{displayAdvertisementsBean.getAdvertisementsFromSearch()}"/>
			<br/>
			<br/>
			<h:dataTable value="#{displayAdvertisementsBean.getAdvertisementsFromSearch()}" var="o">

    			<h:column>
    				<!-- column header -->
    				<f:facet name="header">Id</f:facet>
    				<!-- row record -->
    				#{o.advertisement_id}
    			</h:column>
 
    			<h:column>
    				<f:facet name="header">Title</f:facet>
    				#{o.title}
    			</h:column>
 
    			<h:column>
    				<f:facet name="header">Content</f:facet>
    				#{o.content}
    			</h:column>
 
    			<h:column>
    				<f:facet name="header">Category</f:facet>
    				#{o.category.name}
    			</h:column>
    			
    			<h:column>
    				<f:facet name="header">Type</f:facet>
    				#{o.type.name}
    			</h:column>
    			
    			<h:column>
    				<f:facet name="header">Link</f:facet>
    				<h:commandLink value="LINK" action="result">
    					<f:setPropertyActionListener target="#{displayAdvertisementsBean.selectedAdvertisement}" value="#{o}" />
    				</h:commandLink>
    			</h:column>
 
    		</h:dataTable>
		</h:panelGrid>
	</h:form>
	</body>
</html>